package iscte.iul.dcti.pa.al2011_12.utilities;

public class Utils {
//	public static int GetColumnIndex(char abscissa)
	public static String GetColumnIndex(int intIndex) {
		String[] letters = new String[] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
		
		
        String ans = "";
        while(intIndex>-1)
        {	
        	ans = letters[intIndex%26]+ans;
        	intIndex = intIndex/26 - 1;
        }
        return ans;
	}
	
	
	public static int GetColumnIndex(String abscissa) {
		for (int i = 0; i < 1024; i++) {
			if (GetColumnIndex(i).equals(abscissa)) {
				return i;
			}
		}
		return -1;
	}
}
